package com.infodms.dms.actions.sales.marketmanage.planissued;

import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.infodms.dms.actions.common.FileUploadManager;
import com.infodms.dms.bean.AclUserBean;
import com.infodms.dms.common.Constant;
import com.infodms.dms.common.ErrorCodeConstant;
import com.infodms.dms.common.getCompanyId.GetOemcompanyId;
import com.infodms.dms.common.materialManager.MaterialGroupManagerDao;
import com.infodms.dms.dao.sales.marketmanage.planissued.ActivitiesPlanIssuedDao;
import com.infodms.dms.dao.sales.marketmanage.planissued.ActivitiesSummaryIssuedDao;
import com.infodms.dms.dao.sales.marketmanage.planmanage.ActivitiesPlanManageDao;
import com.infodms.dms.exception.BizException;
import com.infodms.dms.po.TmOrgPO;
import com.infodms.dms.po.TtCampaignExecutePO;
import com.infodms.dms.po.TtCampaignGroupRPO;
import com.infodms.dms.po.TtCampaignPO;
import com.infodms.dms.po.TtCampaignSpaceExecutePO;
import com.infodms.dms.util.CommonUtils;
import com.infodms.dms.util.sequenceUitl.SequenceManager;
import com.infoservice.mvc.context.ActionContext;
import com.infoservice.mvc.context.RequestWrapper;
import com.infoservice.po3.bean.PageResult;

/**
 * @Title: 活动方案制定Action
 * @Description:InfoFrame3.0.V01
 * @Copyright: Copyright (c) 2010
 * @Company: www.infoservice.com.cn
 * @Date: 2010-6-29
 * @author 
 * @mail  
 * @version 1.0
 * @remark 
 */
public class ActivitiesPlanMake {
	public Logger logger = Logger.getLogger(ActivitiesPlanMake.class);   
	ActivitiesPlanIssuedDao dao  = ActivitiesPlanIssuedDao.getInstance();
	private ActionContext act = ActionContext.getContext();
	RequestWrapper request = act.getRequest();
	private final String initUrl = "/jsp/sales/marketmanage/planissued/activitiesPlanMake.jsp";
	private final String addUrl = "/jsp/sales/marketmanage/planissued/activitiesPlanMakeAdd.jsp";
	private final String modelUrl = "/jsp/sales/marketmanage/planissued/activitiesModelQuery.jsp";
	private final String dealerAttachUrl ="/jsp/sales/marketmanage/planissued/activitiesDealerAndAttach.jsp";
	
	// 修改页面
	private final String modifyUrl = "/jsp/sales/marketmanage/planissued/activitiesPlanMakeUpdate.jsp";
	
	// 下发范围选择经销商页面
	//private final String dealerSelUrl ="/jsp/sales/marketmanage/planissued/selectDealer.jsp";
	private final String dealerSelUrl ="/dialog/showAllAreaDealers.jsp";
	/**
	 * 活动方案制定页面初始化
	 */
	public void activitiesPlanMakeInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			List<Map<String, Object>> areaList = MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaList", areaList);
			act.setForword(initUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动方案制定页面初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 活动方案制定页面初始化
	 */
	public void activitiesPlanMakeQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String areaId=request.getParamValue("areaId");//业务范围ID
			String campaignNo = request.getParamValue("campaignNo");				//车厂方案编号
			String campaignName = request.getParamValue("campaignName");			//方案名称
			String campaignSubject = request.getParamValue("campaignSubject");		//活动主题
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);   
			Long poseId = logonUser.getPoseId() ;
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
//			PageResult<Map<String, Object>> ps = dao.selectCampaign(campaignNo, campaignName, campaignSubject, curPage, Constant.PAGE_SIZE);
			PageResult<Map<String, Object>> ps = dao.selectCampaign(poseId, areaId,oemCompanyId,campaignNo, campaignName, campaignSubject, curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动方案制定页面初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 活动车型查询初始化
	 */
	public void queryModelInit() throws Exception{
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			act.setForword(modelUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动车型查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 *  活动车型查询
	 */
	public void queryModel(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String prodCode = request.getParamValue("prodCode");
			String prodName = request.getParamValue("prodName");
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			PageResult<Map<String, Object>> ps = dao.selectModel(prodCode, prodName,curPage,Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动车型查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 活动方案制定新增页面初始化
	 * 更改内容：方案编号改为自动生成，需客户提供编码规则
	 * modify by wjb at 2010-08-24
	 */
	public void activitiesPlanMakeAddInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			List<Map<String, Object>> areaList = MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaList", areaList);
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			List<Map<String, Object>> list = dao.selectPinPai(oemCompanyId);
			String campaignNo = SequenceManager.getSequence("CPN");//方案编号
			act.setOutData("list", list);
			act.setOutData("campaignNo", campaignNo);
			act.setForword(addUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动方案制定新增页面初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 活动方案制定保存
	 */
	public void activitiesPlanMakeSaveOLD(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));							//业务范围ID
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			Long companyId=GetOemcompanyId.getOemCompanyId(logonUser);
			
			TtCampaignPO ttcp = new TtCampaignPO();															//市场活动方案表
			String campaignId = SequenceManager.getSequence("");
			ttcp.setCampaignId(Long.parseLong(campaignId));
			ttcp.setGroupId(Long.parseLong(groupId));
			ttcp.setCampaignModel(Long.parseLong(modelId));
			ttcp.setOemCompanyId(companyId);
			ttcp.setCampaignNo(campaignNo.trim());
			ttcp.setCampaignName(campaignName.trim());
			ttcp.setStartDate(fmat.parse(startDate));
			ttcp.setEndDate(fmat.parse(endDate));
			ttcp.setCampaignSubject(campaignSubject.trim());
			ttcp.setCampaignObject(campaignObject.trim());
			ttcp.setCampaignPurpose(campaignPurpose.trim());
			ttcp.setCampaignNeed(campaignNeed.trim());
			ttcp.setCampaignDesc(campaignDesc.trim());
			ttcp.setCampaignType(Constant.CAMPAIGN_TYPE_01);
			ttcp.setCreateDate(new Date(System.currentTimeMillis()));
			ttcp.setCreateBy(logonUser.getUserId());
			ttcp.setAreaId(Long.parseLong(areaId));
			dao.insert(ttcp);
			act.setOutData("campaignId", campaignId);
			act.setForword(dealerAttachUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.SAVE_FAILURE_CODE,"活动方案制定保存");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	
	/**
	 * 活动方案制定保存(用于长安汽车)
	 * 更改内容：1.方案编号改为自动生成，需客户提供编码规则
	 * 			2.活动车型增加多选。
	 * modify by wjb at 2010-08-24
	 */
	@SuppressWarnings("unchecked")
	public void activitiesPlanMakeSave(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			
		    	
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			Long companyId=GetOemcompanyId.getOemCompanyId(logonUser);
			
			TtCampaignPO ttcp = new TtCampaignPO();//市场活动方案表
			
			
			String campaignId = SequenceManager.getSequence("");
			ttcp.setCampaignId(Long.parseLong(campaignId));
			ttcp.setGroupId(Long.parseLong(groupId));
//			ttcp.setCampaignModel(Long.parseLong(modelId));
			ttcp.setOemCompanyId(companyId);
			ttcp.setCampaignNo(campaignNo.trim());
			ttcp.setCampaignName(campaignName.trim());
			ttcp.setStartDate(fmat.parse(startDate));
			ttcp.setEndDate(fmat.parse(endDate));
			ttcp.setCampaignSubject(campaignSubject.trim());
			ttcp.setCampaignObject(campaignObject.trim());
			ttcp.setCampaignPurpose(campaignPurpose.trim());
			ttcp.setCampaignNeed(campaignNeed.trim());
			ttcp.setCampaignDesc(campaignDesc.trim());
			ttcp.setAreaId(Long.parseLong(areaId));
			ttcp.setCampaignType(Constant.CAMPAIGN_TYPE_01);
			ttcp.setCreateDate(new Date(System.currentTimeMillis()));
			ttcp.setCreateBy(logonUser.getUserId());
			dao.insert(ttcp);
			TtCampaignGroupRPO tgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			//插入关系表
			String[] modelIds = modelId.split(",");
			if(modelIds != null && modelIds.length > 0){
				for(int i=0;i < modelIds.length;i++){
					String rid = SequenceManager.getSequence("");
					tgr.setRelationId(new Long(rid));
					tgr.setCampaignId(new Long(campaignId));
					tgr.setCampaignModel(new Long(modelIds[i]));
					tgr.setOemCompanyId(companyId);
					tgr.setCreateDate(new Date(System.currentTimeMillis()));
					tgr.setCreateBy(logonUser.getUserId());
					dao.insert(tgr);
				}
			}
			act.setOutData("areaId", areaId);
			act.setOutData("campaignId", campaignId);
			act.setForword(dealerAttachUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.SAVE_FAILURE_CODE,"活动方案制定保存");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	
	/**
	 * 方案范围经销商查询
	 */
	public void queryDealerInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));
			act.setOutData("CAMPAIGNID", campaignId);
			act.setOutData("areaId",areaId);
			act.setForword(dealerSelUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"活动方案下发选择经销商");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 新增页面车厂活动方案执行保存
	 */
	public void saveExecutePlan(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Long orgId = logonUser.getOrgId() ;
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));     //活动方案id
			
			String[] dlrIds = request.getParamValue("orgCode").split(",");									//欲下发区域ID
			
			String executeId = "";
			String []fjids = request.getParamValues("fjids");							            //附件ID
			executeId = SequenceManager.getSequence("");                                //执行方案id
			TtCampaignSpaceExecutePO po1 = new TtCampaignSpaceExecutePO();
			po1.setSpaceId(new Long(executeId));
			po1.setCampaignId(new Long(campaignId));
			po1.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_12);
			po1.setCreateBy(logonUser.getUserId());
			po1.setCreateDate(new Date(System.currentTimeMillis()));
			po1.setOrgId(orgId);
			dao.addExecutePlan(po1);
			if(null!= dlrIds&&dlrIds.length>0){
				
				for(int i=0;i<dlrIds.length;i++){
						TmOrgPO tmOrgPo=new TmOrgPO();
						TmOrgPO myPo=new TmOrgPO();
						  tmOrgPo.setOrgId(new Long(dlrIds[i]));
					if(dao.select(tmOrgPo).size()>0){
					myPo=(TmOrgPO) dao.select(tmOrgPo).get(0);
					executeId = SequenceManager.getSequence("");                                //执行方案id
					TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
					po.setSpaceId(new Long(executeId));
					po.setCampaignId(new Long(campaignId));
					po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_12);
					po.setCreateBy(logonUser.getUserId());
					po.setCreateDate(new Date(System.currentTimeMillis()));
					po.setOrgId(myPo.getOrgId());
					dao.addExecutePlan(po);
					}
				}
				
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			
			act.setOutData("returnValue", 1);
			

		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.SAVE_FAILURE_CODE,"活动执行方案保存");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
		
	}
	
	
	/**
	 * 新增页面活动方案下发
	 */
	public void assignPlan(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try {
			Long orgId = logonUser.getOrgId() ;
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));      //活动方案id
			String[] dlrIds = request.getParamValues("dlrIds");									 //欲下发经销商ID
			String executeId = "";
			String []fjids = request.getParamValues("fjids");						             //附件ID
			executeId = SequenceManager.getSequence("");     
			TtCampaignSpaceExecutePO po1 = new TtCampaignSpaceExecutePO();
			po1.setSpaceId(new Long(executeId));
			po1.setCampaignId(new Long(campaignId));
			po1.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
			po1.setCreateBy(logonUser.getUserId());
			po1.setCreateDate(new Date(System.currentTimeMillis()));
			po1.setOrgId(orgId);
			dao.addExecutePlan(po1);
			if(null!= dlrIds){
				for(int i=0;i<dlrIds.length;i++){
					executeId = SequenceManager.getSequence("");                                  //执行方案id
					TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
					po.setSpaceId(new Long(executeId));
					po.setCampaignId(new Long(campaignId));
					po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
					po.setCreateBy(logonUser.getUserId());
					po.setCreateDate(new Date(System.currentTimeMillis()));
					po.setOrgId(new Long(dlrIds[i]));
					
					dao.addExecutePlan(po);
					
				}
				
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			act.setOutData("returnValue", 1);
			
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.UPDATE_FAILURE_CODE,"活动方案下发");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
		
	}
	
	
	
	/**
	 * 活动方案删除
	 */
	public void deletePlanOLD(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try {
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));      //活动方案id
			
			List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,"");
			
			Map map = new HashMap();
			
			// 根据campaignId删除执行方案中的数据
			if(null!=executePlans&&executePlans.size()!=0){
				for(int i=0;i<executePlans.size();i++){
					map = executePlans.get(i);
					String executeId = CommonUtils.checkNull(map.get("EXECUTE_ID"));
					
					TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
					po.setSpaceId(Long.parseLong(executeId));
					
					dao.delExecutePlan(po);
				}
			}
			
			ActivitiesSummaryIssuedDao asDao = 	new ActivitiesSummaryIssuedDao();
			// 删除活动方案表中的数据
			TtCampaignPO ttcp = new TtCampaignPO();			
			ttcp.setCampaignId(Long.parseLong(campaignId));
			asDao.deleteCampaign(ttcp);
			
			act.setOutData("returnValue", 1);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.DELETE_FAILURE_CODE,"活动方案删除");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 活动方案删除（用于长安汽车）
	 */
	@SuppressWarnings("unchecked")
	public void deletePlan(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try {
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));      //活动方案id
			
			List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,"");
			
			Map map = new HashMap();
			
			// 根据campaignId删除执行方案中的数据
			if(null!=executePlans&&executePlans.size()!=0){
				for(int i=0;i<executePlans.size();i++){
					map = executePlans.get(i);
					String executeId = CommonUtils.checkNull(map.get("SPACE_ID"));
					
					TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
					po.setSpaceId(Long.parseLong(executeId));
					
					dao.delExecutePlan(po);
				}
			}
			
			//根据campaignId删除关系表中的数据
			//modify at 2010-08-25
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			TtCampaignGroupRPO dtgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			dtgr.setCampaignId(new Long(campaignId));
			dtgr.setOemCompanyId(oemCompanyId);
			dao.delete(dtgr);
			
			ActivitiesSummaryIssuedDao asDao = 	new ActivitiesSummaryIssuedDao();
			// 删除活动方案表中的数据
			TtCampaignPO ttcp = new TtCampaignPO();			
			ttcp.setCampaignId(Long.parseLong(campaignId));
			asDao.deleteCampaign(ttcp);
			
			act.setOutData("returnValue", 1);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.DELETE_FAILURE_CODE,"活动方案删除");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	
	/**
	 * 活动方案修改初始化
	 */
	public void updatePlanInit(){
	
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try {
			List<Map<String, Object>> areaList = MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaList", areaList);
			//取得活动方案id
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));     
			
			//查询品牌
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			List<Map<String, Object>> list = dao.selectPinPai(oemCompanyId);
			//通过活动方案id查询活动方案信息
			Map<String, Object> compaignMap = dao.getCompaignPlanById(campaignId);
			//根据campaignId查询执行方案
			List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,"");   
			if(null!=executePlans&&executePlans.size()!=0){
				act.setOutData("executePlans", executePlans);
			}
			
			//根据campaignId查询上传附件
			List<Map<String, Object>> attachList = dao.getAttachInfos(campaignId);
			if(null!=attachList&&attachList.size()!=0){
				act.setOutData("attachList", attachList);
			}
			act.setOutData("campaignId", campaignId);
			act.setOutData("list", list);
			act.setOutData("compaignMap", compaignMap);
			
			act.setForword(modifyUrl);
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.ACTION_NAME_ERROR_CODE,"活动方案修改初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
			
	}
	
	/**
	 * 活动方案制定的修改保存
	 */
	@SuppressWarnings("unchecked")
	public void updateExecutePlanOLD(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try{
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));//范围ID
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));                 //活动方案id
			
			TtCampaignPO tcpo1 = new TtCampaignPO();	
			tcpo1.setCampaignId(new Long(campaignId));
			TtCampaignPO tcpo2 = new TtCampaignPO();
			tcpo2.setCampaignModel(new Long(modelId));
			tcpo2.setGroupId(new Long(groupId));
			tcpo2.setCampaignNo(campaignNo);
			tcpo2.setCampaignName(campaignName);
			tcpo2.setStartDate(fmat.parse(startDate));
			tcpo2.setEndDate(fmat.parse(endDate));
			tcpo2.setCampaignSubject(campaignSubject);
			tcpo2.setCampaignObject(campaignObject);
			tcpo2.setCampaignPurpose(campaignPurpose);
			tcpo2.setCampaignNeed(campaignNeed);
			tcpo2.setCampaignDesc(campaignDesc);
			tcpo2.setUpdateBy(logonUser.getUserId());
			tcpo2.setUpdateDate(new Date(System.currentTimeMillis()));
			tcpo2.setAreaId(Long.parseLong(areaId));
			dao.updateCampaignPlan(tcpo1, tcpo2);
			
			
			//页面删除的经销商id
			String delDlrIds = CommonUtils.checkNull(request.getParamValue("delDlrIds"));        
			String delDealers = delDlrIds.replaceFirst(",", "");
			String [] delDlrArr = delDealers.split(",");
			if(null!=delDlrArr&&0!=delDlrArr.length){
				for(int i=0;i<delDlrArr.length;i++){
					if(!"".equals(delDlrArr[i])){
						deleteExecutePlanByRow(campaignId,delDlrArr[i]);
					}
					
				}
			}
			
			//页面删除的附件
			String delAttachs = CommonUtils.checkNull(request.getParamValue("delAttachs"));       
			String delAttachIds = delAttachs.replaceFirst(",", "");
			String [] delAttachArr = delAttachIds.split(",");
			if(null!=delAttachArr&&0!=delAttachArr.length){
				for(int i=0;i<delAttachArr.length;i++){
					FileUploadManager.delfileUploadByBusiness(delAttachArr[i], logonUser);
				}
			}
			
			//执行方案下发的经销商Id
			String[] dlrIds = request.getParamValues("dlrIds");                                  
			//附件ID
			String []fjids = request.getParamValues("fjids");							             
			String executeId ="";
			if(null!=dlrIds&&dlrIds.length>0){
				for(int i=0;i<dlrIds.length;i++){
					// 查询执行方案表中是否存在该经销商的数据
					List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,dlrIds[i]);
					
					//如果不存在插入
					if(null==executePlans||0==executePlans.size()){
						TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
						executeId = SequenceManager.getSequence(""); 
						po.setSpaceId(new Long(executeId));
						po.setCampaignId(new Long(campaignId));
						po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_12);
						po.setCreateBy(logonUser.getUserId());
						po.setCreateDate(new Date(System.currentTimeMillis()));
						po.setOrgId(new Long(dlrIds[i]));
						
						dao.addExecutePlan(po);
						
					}
				}
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			
			act.setOutData("returnValue", 1);
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.UPDATE_FAILURE_CODE,"活动方案修改");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 活动方案制定的修改保存（用于长安汽车）
	 */
	@SuppressWarnings("unchecked")
	public void updateExecutePlan(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try{
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围ID
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));                 //活动方案id
			
			TtCampaignPO tcpo1 = new TtCampaignPO();	
			tcpo1.setCampaignId(new Long(campaignId));
			TtCampaignPO tcpo2 = new TtCampaignPO();
			tcpo2.setGroupId(new Long(groupId));
			tcpo2.setCampaignName(campaignName);
			tcpo2.setStartDate(fmat.parse(startDate));
			tcpo2.setEndDate(fmat.parse(endDate));
			tcpo2.setCampaignSubject(campaignSubject);
			tcpo2.setCampaignObject(campaignObject);
			tcpo2.setCampaignPurpose(campaignPurpose);
			tcpo2.setCampaignNeed(campaignNeed);
			tcpo2.setCampaignDesc(campaignDesc);
			tcpo2.setUpdateBy(logonUser.getUserId());
			tcpo2.setAreaId(Long.parseLong(areaId));
			tcpo2.setUpdateDate(new Date(System.currentTimeMillis()));
			
			dao.updateCampaignPlan(tcpo1, tcpo2);
			
			//先删除关系表，在新增(用于长安汽车)
			//modify at 2010-08-25
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			TtCampaignGroupRPO dtgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			dtgr.setCampaignId(new Long(campaignId));
			dtgr.setOemCompanyId(oemCompanyId);
			dao.delete(dtgr);
			
			TtCampaignGroupRPO tgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			//新增插入关系表
			String[] modelIds = modelId.split(",");
			if(modelIds != null && modelIds.length > 0){
				for(int i=0;i < modelIds.length;i++){
					String rid = SequenceManager.getSequence("");
					tgr.setRelationId(new Long(rid));
					tgr.setCampaignId(new Long(campaignId));
					tgr.setCampaignModel(new Long(modelIds[i]));
					tgr.setOemCompanyId(oemCompanyId);
					tgr.setCreateDate(new Date(System.currentTimeMillis()));
					tgr.setCreateBy(logonUser.getUserId());
					dao.insert(tgr);
				}
			}
			
			//页面删除的区域的id
			String delDlrIds = CommonUtils.checkNull(request.getParamValue("delDlrIds"));        
			String delDealers = delDlrIds.replaceFirst(",", "");
			String [] delDlrArr = delDealers.split(",");
			if(null!=delDlrArr&&0!=delDlrArr.length){
				for(int i=0;i<delDlrArr.length;i++){
					if(!"".equals(delDlrArr[i])){
						deleteExecutePlanByRow(campaignId,delDlrArr[i]);
					}
					
				}
			}
			
			//页面删除的附件
			String delAttachs = CommonUtils.checkNull(request.getParamValue("delAttachs"));       
			String delAttachIds = delAttachs.replaceFirst(",", "");
			String [] delAttachArr = delAttachIds.split(",");
			if(null!=delAttachArr&&0!=delAttachArr.length){
				for(int i=0;i<delAttachArr.length;i++){
					FileUploadManager.delfileUploadByBusiness(delAttachArr[i], logonUser);
				}
			}
			
			//执行方案下发的区域Id
			String[] dlrIds = request.getParamValues("dlrIds");                                  
			//附件ID
			String []fjids = request.getParamValues("fjids");							             
			String executeId ="";
			if(null!=dlrIds&&dlrIds.length>0){
				for(int i=0;i<dlrIds.length;i++){
					// 查询执行方案表中是否存在该经销商的数据
					List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,dlrIds[i]);
					
					//如果不存在插入
					if(null==executePlans||0==executePlans.size()){
						TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
						executeId = SequenceManager.getSequence(""); 
						po.setSpaceId(new Long(executeId));
						po.setCampaignId(new Long(campaignId));
						po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_12);
						po.setCreateBy(logonUser.getUserId());
						po.setCreateDate(new Date(System.currentTimeMillis()));
						po.setOrgId(new Long(dlrIds[i]));
						
						dao.addExecutePlan(po);
						
					}
				}
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			
			act.setOutData("returnValue", 1);
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.UPDATE_FAILURE_CODE,"活动方案修改");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	
	/**
	 * 修改页面中删除经销商
	 */
	public void deleteExecutePlanByRow(String campaignId,String dealerId){
		
			// 通过传参查询出相关记录
			List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,dealerId);
			
			Map<String, Object> map = executePlans.get(0);
			
			// 取得执行方案id
			String executeId = map.get("SPACE_ID").toString();
			
			// 删除
			TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
			po.setSpaceId(Long.parseLong(executeId));
			
			dao.delExecutePlan(po);
			
	}
	
	/**
	 * 修改页面中的下发
	 */
	public void assignExecutePlanOLD(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try{
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));                 //活动方案id
			
			TtCampaignPO tcpo1 = new TtCampaignPO();	
			tcpo1.setCampaignId(new Long(campaignId));
			TtCampaignPO tcpo2 = new TtCampaignPO();
			tcpo2.setCampaignModel(new Long(modelId));
			tcpo2.setGroupId(new Long(groupId));
			tcpo2.setCampaignNo(campaignNo);
			tcpo2.setCampaignName(campaignName);
			tcpo2.setStartDate(fmat.parse(startDate));
			tcpo2.setEndDate(fmat.parse(endDate));
			tcpo2.setCampaignSubject(campaignSubject);
			tcpo2.setCampaignObject(campaignObject);
			tcpo2.setCampaignPurpose(campaignPurpose);
			tcpo2.setCampaignNeed(campaignNeed);
			tcpo2.setCampaignDesc(campaignDesc);
			tcpo2.setAreaId(Long.parseLong(areaId));
			tcpo2.setUpdateBy(logonUser.getUserId());
			tcpo2.setUpdateDate(new Date(System.currentTimeMillis()));
			
			dao.updateCampaignPlan(tcpo1, tcpo2);
			
			//页面删除的经销商id
			String delDlrIds = CommonUtils.checkNull(request.getParamValue("delDlrIds"));        
			String delDealers = delDlrIds.replaceFirst(",", "");
			String [] delDlrArr = delDealers.split(",");
			if(null!=delDlrArr&&0!=delDlrArr.length){
				for(int i=0;i<delDlrArr.length;i++){
					if(!"".equals(delDlrArr[i])){
						deleteExecutePlanByRow(campaignId,delDlrArr[i]);
					}
				}
			}
			
			//页面删除的附件
			String delAttachs = CommonUtils.checkNull(request.getParamValue("delAttachs"));       
			String delAttachIds = delAttachs.replaceFirst(",", "");
			String [] delAttachArr = delAttachIds.split(",");
			if(null!=delAttachArr&&0!=delAttachArr.length){
				for(int i=0;i<delAttachArr.length;i++){
					FileUploadManager.delfileUploadByBusiness(delAttachArr[i], logonUser);
				}
			}
			
			//执行方案下发的经销商Id
			String[] dlrIds = request.getParamValues("dlrIds");                                  
			//附件ID
			String []fjids = request.getParamValues("fjids");				             
			String executeId ="";
			if(null!=dlrIds&&dlrIds.length>0){
				for(int i=0;i<dlrIds.length;i++){
					// 查询执行方案表中是否存在该经销商的数据
					List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,dlrIds[i]);
					
					//如果不存在插入
					if(null==executePlans||0==executePlans.size()){
						TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
						executeId = SequenceManager.getSequence(""); 
						po.setSpaceId(new Long(executeId));
						po.setCampaignId(new Long(campaignId));
						po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
						po.setCreateBy(logonUser.getUserId());
						po.setCreateDate(new Date(System.currentTimeMillis()));
						po.setOrgId(new Long(dlrIds[i]));
						
						dao.addExecutePlan(po);
						
					}else{
						TtCampaignSpaceExecutePO po1 = new TtCampaignSpaceExecutePO();
						po1.setOrgId(Long.parseLong(dlrIds[i]));
						po1.setCampaignId(Long.parseLong(campaignId));
						
						TtCampaignSpaceExecutePO po2 = new TtCampaignSpaceExecutePO();
						po2.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
						po2.setUpdateBy(logonUser.getUserId());
						po2.setUpdateDate(new Date(System.currentTimeMillis()));
						
						dao.updateExecutePlan(po1,po2);
					}
				}
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			
			act.setOutData("returnValue", 1);
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.UPDATE_FAILURE_CODE,"活动方案下发");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 修改页面中的下发(用于长安汽车)
	 */
	@SuppressWarnings("unchecked")
	public void assignExecutePlan(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		
		try{
			String modelId = CommonUtils.checkNull(request.getParamValue("modelId"));						//活动车型ID
			String groupId = CommonUtils.checkNull(request.getParamValue("groupId"));						//品牌ID
			String campaignNo = CommonUtils.checkNull(request.getParamValue("campaignNo"));					//车厂方案编号
			String campaignName = CommonUtils.checkNull(request.getParamValue("campaignName"));				//方案名称
			String startDate = CommonUtils.checkNull(request.getParamValue("startDate"));					//活动开始时间
			String endDate = CommonUtils.checkNull(request.getParamValue("endDate"));						//活动结束时间
			String campaignSubject = CommonUtils.checkNull(request.getParamValue("campaignSubject"));		//活动主题
			String campaignObject = CommonUtils.checkNull(request.getParamValue("campaignObject"));			//活动对象
			String campaignPurpose = CommonUtils.checkNull(request.getParamValue("campaignPurpose"));		//活动目的
			String campaignNeed = CommonUtils.checkNull(request.getParamValue("campaignNeed"));				//活动要求
			String campaignDesc = CommonUtils.checkNull(request.getParamValue("campaignDesc"));				//活动主要内容
			SimpleDateFormat fmat = new SimpleDateFormat ("yyyy-MM-dd");
			String areaId=CommonUtils.checkNull(request.getParamValue("areaId"));
			String campaignId = CommonUtils.checkNull(request.getParamValue("campaignId"));                 //活动方案id
			
			TtCampaignPO tcpo1 = new TtCampaignPO();	
			tcpo1.setCampaignId(new Long(campaignId));
			TtCampaignPO tcpo2 = new TtCampaignPO();
//			tcpo2.setCampaignModel(new Long(modelId));
			tcpo2.setGroupId(new Long(groupId));
//			tcpo2.setCampaignNo(campaignNo);
			tcpo2.setAreaId(Long.parseLong(areaId));
			tcpo2.setCampaignName(campaignName);
			tcpo2.setStartDate(fmat.parse(startDate));
			tcpo2.setEndDate(fmat.parse(endDate));
			tcpo2.setCampaignSubject(campaignSubject);
			tcpo2.setCampaignObject(campaignObject);
			tcpo2.setCampaignPurpose(campaignPurpose);
			tcpo2.setCampaignNeed(campaignNeed);
			tcpo2.setCampaignDesc(campaignDesc);
			tcpo2.setUpdateBy(logonUser.getUserId());
			tcpo2.setUpdateDate(new Date(System.currentTimeMillis()));
			
			dao.updateCampaignPlan(tcpo1, tcpo2);
			
//			先删除关系表，在新增(用于长安汽车)
			//modify at 2010-08-25
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			TtCampaignGroupRPO dtgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			dtgr.setCampaignId(new Long(campaignId));
			dtgr.setOemCompanyId(oemCompanyId);
			dao.delete(dtgr);
			
			TtCampaignGroupRPO tgr = new TtCampaignGroupRPO(); //市场活动和车型明细关系表
			//新增插入关系表
			String[] modelIds = modelId.split(",");
			if(modelIds != null && modelIds.length > 0){
				for(int i=0;i < modelIds.length;i++){
					String rid = SequenceManager.getSequence("");
					tgr.setRelationId(new Long(rid));
					tgr.setCampaignId(new Long(campaignId));
					tgr.setCampaignModel(new Long(modelIds[i]));
					tgr.setOemCompanyId(oemCompanyId);
					tgr.setCreateDate(new Date(System.currentTimeMillis()));
					tgr.setCreateBy(logonUser.getUserId());
					dao.insert(tgr);
				}
			}
			
			//页面删除的经销商id
			String delDlrIds = CommonUtils.checkNull(request.getParamValue("delDlrIds"));        
			String delDealers = delDlrIds.replaceFirst(",", "");
			String [] delDlrArr = delDealers.split(",");
			if(null!=delDlrArr&&0!=delDlrArr.length){
				for(int i=0;i<delDlrArr.length;i++){
					if(!"".equals(delDlrArr[i])){
						deleteExecutePlanByRow(campaignId,delDlrArr[i]);
					}
				}
			}
			
			//页面删除的附件
			String delAttachs = CommonUtils.checkNull(request.getParamValue("delAttachs"));       
			String delAttachIds = delAttachs.replaceFirst(",", "");
			String [] delAttachArr = delAttachIds.split(",");
			if(null!=delAttachArr&&0!=delAttachArr.length){
				for(int i=0;i<delAttachArr.length;i++){
					FileUploadManager.delfileUploadByBusiness(delAttachArr[i], logonUser);
				}
			}
			
			//执行方案下发区域Id
			String[] dlrIds = request.getParamValues("dlrIds");                                  
			//附件ID
			String []fjids = request.getParamValues("fjids");				             
			String executeId ="";
			if(null!=dlrIds&&dlrIds.length>0){
				for(int i=0;i<dlrIds.length;i++){
					// 查询执行方案表中是否存在该经销商的数据
					List<Map<String, Object>> executePlans = dao.getExecutePlanByCmpId(campaignId,dlrIds[i]);
					
					//如果不存在插入
					if(null==executePlans||0==executePlans.size()){
						TtCampaignSpaceExecutePO po = new TtCampaignSpaceExecutePO();
						executeId = SequenceManager.getSequence(""); 
						po.setSpaceId(new Long(executeId));
						po.setCampaignId(new Long(campaignId));
						po.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
						po.setCreateBy(logonUser.getUserId());
						po.setCreateDate(new Date(System.currentTimeMillis()));
						po.setOrgId(new Long(dlrIds[i]));
						
						dao.addExecutePlan(po);
						
					}else{
						TtCampaignSpaceExecutePO po1 = new TtCampaignSpaceExecutePO();
						po1.setOrgId(Long.parseLong(dlrIds[i]));
						po1.setCampaignId(Long.parseLong(campaignId));
						
						TtCampaignSpaceExecutePO po2 = new TtCampaignSpaceExecutePO();
						po2.setCheckStatus(Constant.CAMPAIGN_CHECK_STATUS_02);
						po2.setUpdateBy(logonUser.getUserId());
						po2.setUpdateDate(new Date(System.currentTimeMillis()));
						dao.updateExecutePlan(po1,po2);
					}
				}
			}
			
			//附件添加
			FileUploadManager.fileUploadByBusiness(campaignId, fjids, logonUser);
			
			act.setOutData("returnValue", 1);
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.UPDATE_FAILURE_CODE,"活动方案下发");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}	
}
